<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>师生一体化教考通系统</title>
    <!-- Font Awesome for icons -->
    <link rel="stylesheet"
          href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="/static/css/bootstrap.css">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
        }

        .navbar {
            background-color: #337ab7;
            margin-bottom: 20px;
            border-radius: 0;
        }

        .navbar .navbar-brand,
        .navbar .nav > li > a {
            color: #fff;
        }

        .navbar .navbar-brand {
            font-size: 24px;
        }

        .navbar .nav > li > a:hover,
        .navbar .nav > li > a:focus {
            background-color: #286090;
        }

        .navbar .user-name {
            color: #fff;
            font-size: 18px;
            margin-top: 8px;
        }

        .content {
            padding: 20px;
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .form-inline .form-group {
            margin-right: 10px;
        }

        .form-inline .btn {
            margin-left: 10px;
        }

        .table-container {
            margin-top: 20px;
        }

        /* 调整添加按钮的样式 */
        .add-btn-container {
            margin-top: -33px;
            text-align: right;
            margin-right: 80px;
        }

        .add-btn-container button {
            margin-left: 10px;
        }
    </style>
</head>
<body>
<!-- Navigation Bar -->
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#"><i class="fa fa-desktop"></i> 师生一体化教考通系统</a>
        </div>
        <ul class="nav navbar-nav">
            <li><a href="{% url 'course_information_stu' %}">我的课程</a></li>
            <li><a href="{% url 'course_select_stu' %}">选课</a></li>
            <li><a href="{% url 'test_information_stu' %}">考试信息</a></li>
            <li class="active"><a href="{% url 'work_information_stu' %}">作业信息</a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
            <li><a href="#"><i class="fa fa-user"></i> {{ user }}</a></li>
            <li><a href="{% url 'load' %}">切换账号</a></li>
        </ul>
    </div>
</nav>


<div class="container">
    <div class="content">
        <!-- Form: Test Information Search -->
        <form class="form-inline" style="width: 90%" method="get" novalidate action={% url 'work_information_stu' %}>
            {% csrf_token %}
            <div class="form-group" style="width: 20%">
                <label>{{ form_course.cname.label }}</label>
                <span style="color: red"> {{ form_course.cname }}</span>
            </div>
            {% for flied in form_work %}
                {% if flied.label != "课程号" %}
                    <div class="form-group" style="width: 20%">
                        <label>{{ flied.label }}</label>
                        <span style="color: red"> {{ flied }}</span>
                    </div>
                {% endif %}

            {% endfor %}

            <button type="submit" class="btn btn-primary" style="position: absolute;top:118px">搜索</button>

        </form>

        {#        <!-- 添加按钮 -->#}
        {#        <div class="add-btn-container">#}
        {#            <form action="{% url 'work_add' %}">#}
        {#                <button type="submit" class="btn btn-success" data-toggle="modal" data-target="#editModal">#}
        {#                    发布作业信息#}
        {#                </button>#}
        {#            </form>#}
        {#        </div>#}

        <!-- Table: Student Information -->
        <div class="table-container">
            <table class="table table-striped">
                <tr>
                    <th>课程名</th>
                    <th>作业名</th>
                    <th>提交时间</th>
                    <th>提交平台</th>
                </tr>

                {% for key, value in cname.items %}
                    {% for obj in homework %}
                        {% if obj.cno == key %}
                            <tr>
                                <td>{{ value }}</td> <!-- 这里使用课程名 value -->
                                <td>{{ obj.workno }}</td>
                                <td>{{ obj.homework_time }}</td>
                                <td>{{ obj.plateform }}</td>
                            </tr>
                        {% endif %}
                    {% endfor %}
                {% endfor %}

            </table>
        </div>
    </div>
</div>

</body>
</html>
